wayland: Explicitly handle classic mode for now
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Jun 2014 14:34:43 +0000 (16:34 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 6 Jun 2014 13:32:59 +0000 (15:32 +0200)
There are plans to add session-dependent defaults to GSettings
(based on the newly standardized XDG_CURRENT_DESKTOP); until
then, the WM uses a different schema for its button-layout
setting in classic mode. So for the time being, do the same
and pick the alternative schema when XDG_CURRENT_DESKTOP
indicates that we are in a classic session.
(It's not pretty, but hopefully won't be with us for too long ...)

https://bugzilla.gnome.org/show_bug.cgi?id=731273

gdk/wayland/gdkscreen-wayland.c

index 261ac20167bbdaa667e910e0c94b7c960770eecc..16b54b86f5d143bd3e91758788434a3f1a499159 100644 (file)
@@ -482,6 +482,9 @@ update_xft_settings (GdkScreen *screen)
     }
 }
 
+#define WM_SETTINGS_SCHEMA "org.gnome.desktop.wm.preferences"
+#define CLASSIC_WM_SETTINGS_SCHEMA "org.gnome.shell.extensions.classic-overrides"
+
 typedef struct _TranslationEntry TranslationEntry;
 struct _TranslationEntry {
   const gchar *schema;
@@ -513,7 +516,8 @@ static TranslationEntry translations[] = {
   { "org.gnome.desktop.sound", "input-feedback-sounds", "gtk-enable-input-feedback-sounds", G_TYPE_BOOLEAN, { . b = FALSE } },
   { "org.gnome.desktop.privacy", "recent-files-max-age", "gtk-recent-files-max-age", G_TYPE_INT, { .i = 30 } },
   { "org.gnome.desktop.privacy", "remember-recent-files",    "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } },
-  { "org.gnome.desktop.wm.preferences", "button-layout",    "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
+  { WM_SETTINGS_SCHEMA, "button-layout",    "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
+  { CLASSIC_WM_SETTINGS_SCHEMA, "button-layout",   "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
   { "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
   { "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
   { "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
@@ -690,9 +694,19 @@ set_decoration_layout_from_entry (GdkScreen        *screen,
                                   GValue           *value)
 {
   GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
-  GSettings *settings;
-
-  settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, entry->schema);
+  GSettings *settings = NULL;
+  const char *session;
+
+  /* Hack: until we get session-dependent defaults in GSettings,
+   *       swap out the usual schema for the "classic" one when
+   *       running in classic mode
+   */
+  session = g_getenv ("XDG_CURRENT_DESKTOP");
+  if (session && strstr (session, "GNOME-Classic"))
+    settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, CLASSIC_WM_SETTINGS_SCHEMA);
+
+  if (settings == NULL)
+    settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, WM_SETTINGS_SCHEMA);
 
   if (settings)
     {